package Colecciones;

import Modelo.EstructuraFila;
import Modelo.PsExtOrgTbl;
import Modelo.PsOrgCntctPhn;
import Modelo.PsOrgContact;
import Modelo.PsOrgLocPhones;
import Modelo.PsOrgLocation;
import Modelo.TransaccionSql;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;

/**
 * @deprecated 
 * @author Administrator
 */
public class InsertarEmpresa
{
  private static void insertar(PsExtOrgTbl obj)
    throws MetadataException, IllegalAccessException, InvocationTargetException, SQLException
  {
    EstructuraFila ef = PsExtOrgTbl.getEstructuraFila();
    String tableName = PsExtOrgTbl.getTableName();
    String strInsert = Utils.getInsertString(obj, ef, tableName);

    TransaccionSql.insertar(strInsert);
  }

  private static void insertar(PsOrgCntctPhn obj) throws MetadataException, IllegalAccessException, InvocationTargetException, SQLException
  {
    EstructuraFila ef = PsOrgCntctPhn.getEstructuraFila();
    String tableName = PsOrgCntctPhn.getTableName();
    String strInsert = Utils.getInsertString(obj, ef, tableName);

    TransaccionSql.insertar(strInsert);
  }

  private static void insertar(PsOrgContact obj) throws MetadataException, IllegalAccessException, InvocationTargetException, SQLException
  {
    EstructuraFila ef = PsOrgContact.getEstructuraFila();
    String tableName = PsOrgContact.getTableName();
    String strInsert = Utils.getInsertString(obj, ef, tableName);

    TransaccionSql.insertar(strInsert);
  }

  private static void insertar(PsOrgLocPhones obj) throws MetadataException, IllegalAccessException, InvocationTargetException, SQLException
  {
    EstructuraFila ef = PsOrgLocPhones.getEstructuraFila();
    String tableName = PsOrgLocPhones.getTableName();
    String strInsert = Utils.getInsertString(obj, ef, tableName);

    TransaccionSql.insertar(strInsert);
  }

  private static void insertar(PsOrgLocation obj) throws MetadataException, IllegalAccessException, InvocationTargetException, SQLException
  {
    EstructuraFila ef = PsOrgLocation.getEstructuraFila();
    String tableName = PsOrgLocation.getTableName();
    String strInsert = Utils.getInsertString(obj, ef, tableName);

    TransaccionSql.insertar(strInsert);
  }

  public static synchronized void crearEmpresa(PsExtOrgTbl psExtOrgTbl, PsOrgLocation psOrgLocation, PsOrgLocPhones psOrgLocPhones, PsOrgContact psOrgContact, PsOrgCntctPhn psOrgCntctPhn)
  {
    try
    {
      //String extOrgId = Empresa.getNewExtOrgId();
      String extOrgId = null;

      psExtOrgTbl.setExt_org_id(extOrgId);
      psOrgLocation.setExt_org_id(extOrgId);
      psOrgLocPhones.setExt_org_id(extOrgId);
      psOrgContact.setExt_org_id(extOrgId);
      psOrgCntctPhn.setExt_org_id(extOrgId);

      insertar(psExtOrgTbl);
      insertar(psOrgLocation);
      insertar(psOrgLocPhones);
      insertar(psOrgContact);
      insertar(psOrgCntctPhn);
    }
    catch (SQLException ex)
    {
      ex.printStackTrace();
    }
    catch (IllegalAccessException ex)
    {
      ex.printStackTrace();
    }
    catch (InvocationTargetException ex)
    {
      ex.printStackTrace();
    }
    catch (MetadataException ex)
    {
      ex.printStackTrace();
    }
  }

  public static boolean crearEmpresa(String extOrgId, String nombre, String llave_tipo_empresa, String llave_ciudad, String telefono, String extension, String direccion)
  {
    throw new UnsupportedOperationException("Not yet implemented");
  }

  public static boolean modificarEmpresa(String extOrgId, String nombre, String llave_tipo_empresa, String llave_ciudad, String telefono, String extension, String direccion)
  {
    throw new UnsupportedOperationException("Not yet implemented");
  }

  public static boolean eliminarEmpresa(String extOrgId)
  {
    throw new UnsupportedOperationException("Not yet implemented");
  }

  public static boolean agregarContactoEmpresa(String extOrgId, String consecutivoContacto, String cargo, String nombre, String telefono, String celular, String fax, String mail)
  {
    throw new UnsupportedOperationException("Not yet implemented");
  }

  public static boolean elimianrContactoEmpresa(String extOrgId, String consecutivoContacto)
  {
    throw new UnsupportedOperationException("Not yet implemented");
  }
}